﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace 图片上下张
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string[] path = Directory.GetFiles(@"C:\Users\86198\Pictures\Screenshots");
        int i = 0;
        private void next_button_Click(object sender, EventArgs e)
        {
            if (i < path.Length-1)
            {
                i++;
                pictureBox1.Image = Image.FromFile(path[i]);
            }
            else
            {
                MessageBox.Show("已经是最后一张");
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(path[1]);
        }

        private void previous_boutton_Click(object sender, EventArgs e)
        {
            if(i>0)
            {
                i--;
                pictureBox1.Image = Image.FromFile(path[i]);
            }
            else
            {
                MessageBox.Show("已经是第1张");
            }
        }
    }
}
